package com.utuan.util;

import java.util.ArrayList;
import java.util.List;

public class TuanUtil {

	public final static String EMPTY_STRING = "";
	public final static String COMMA = ",";

	public static boolean isEmptyString(String str) {
		return str == null || EMPTY_STRING.equals(str.trim());
	}

	public static String convertToString(List<String> strs) {
		return convertToString(strs, COMMA);
	}

	public static String convertToString(List<String> strs, String separator) {
		StringBuilder sb = new StringBuilder();
		if (strs != null && !strs.isEmpty()) {
			for (String str : strs) {
				sb.append(str).append(separator);
			}
			int idx = sb.lastIndexOf(separator);
			sb.delete(idx, idx + separator.length());
		}
		return sb.toString();
	}

	public static void main(String[] args) {
		List<String> s = new ArrayList<String>();
		s.add("a");
		s.add("b");
		System.out.println(convertToString(s, "|x|"));
	}

}
